function newh5file = getDeployedH5File(Prefix, h5file, solver_mode, net_file, net_weights, bMandatoryUpdate, forward_batch_size)
global DeployH5_LogFile
hPfrintf = mycaffe.getPrintf(DeployH5_LogFile);

%%
if ~isempty(Prefix) && str(Prefix).isendwith('-')
    Prefix = [Prefix '-'];
end

%%
TargetPath = fullfile(fileparts(h5file), [Prefix 'Deployed*']);
[bFound, newh5path] = myinput.searchDataByParam(TargetPath, 'st.mat', '', net_file, net_weights);

newh5file = fullfile(newh5path, 'dataset.h5');

if bFound && exist(newh5file, 'file') && ~bMandatoryUpdate
    hPfrintf('H5 file is found in "%s".\n', strrep(newh5path, '%', '%%'));
    return
end

%%
if bMandatoryUpdate
    hPfrintf('"%s" has already existed, but will be updated as required by the user!\n', strrep(h5file, '%', '%%'));
%     pause
else
    hPfrintf('New H5 file will be generated in "%s".\n', strrep(newh5path, '%', '%%'));
end

[X, Y, Chunksize] = mycaffe.deploy_h5file(h5file, solver_mode, net_file, net_weights, forward_batch_size);

srimg.savemat2h5(newh5file, X, Y, Chunksize(end));
hPfrintf('New H5 file has been generated in "%s".\n', strrep(newh5path, '%', '%%'));
